﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using yichu_front;

namespace yichu_manager.BLL
{
   public static class UserService
    {
        public static List<User> getAllUser()
        {
            string sql = "SELECT [id],[地区],[负责人],[账号],[密码],[开关],[加点],[打印],[EXCEL导出],[历史价格],[备注] FROM[dbo].[User]";
            //return SqlSugarHelp.scope.Ado.GetDataTable(sql);
            return SqlSugarHelp.scope.Queryable<User>().ToList();
        }

        internal static int updateUser(User user)
        {
            return SqlSugarHelp.scope.Updateable(user).ExecuteCommand();
        }

        internal static int addUser(User user)
        {
            return SqlSugarHelp.scope.Insertable(user).ExecuteCommand();
        }

        internal static int deleteUser(User user)
        {
            return SqlSugarHelp.scope.Deleteable<User>().Where(user).ExecuteCommand();
        }
    }
}
